/*
 * @file  : app.cpp
 * @author: AreMok
 * @date  : 2011-9-25
 *
 * @details:
 *
 */

#define APP_C_

//Includes
#include "app.h"
#include "task.h"
#include "stm32f10x_gpio.h"
#include "lcd.h"

//Global variables
//Private typedefs
//Private defines
//Private enums
//Private macros
//Private function prototypes
//Private variables

/*
 * @details: none
 *
 * @param  : none
 *
 * @return : none
 * @retval :
 *
 */
void task_led_off(void *p_arg)
{
    static uint8_t i = 0;
    p_arg = p_arg;
    while(1)
    {
        if (i % 2 == 0)
            GPIO_ResetBits(GPIOB, GPIO_Pin_8);
        else
            GPIO_SetBits(GPIOB, GPIO_Pin_8);
        i++;
        //i%=2;
        //LCD_DisplayChar(0,(i + 16) % 128,'M',0xFF00,0x0FFF,2);
        //LCD_DrawPixel(64,64,0xF000);
        //LCD_DisplayChar(60,40,'O',0xFFFF,0,1);
        //LCD_DisplayChar(80,40,'K',0xFFFF,0,1);
        //LCD_SetScreenOrientation((Rotate_H12_V_Match_TypeDef)(i % 4));
        LCD_FillRect(50,50,30,30,0x01F << (i % 3) * 5);
        os_task_delay(1000);
    }
}

/*
 * @details: none
 *
 * @param  : none
 *
 * @return : none
 * @retval :
 *
 */
void task_led_on(void *p_arg)
{
    static uint8_t i = 0;
    p_arg = p_arg;

    while(1)
    {
        //GPIO_SetBits(GPIOB, GPIO_Pin_8);
        if (i == 0)
            GPIO_ResetBits(GPIOB, GPIO_Pin_9);
        else
            GPIO_SetBits(GPIOB, GPIO_Pin_9);
        i++;
        i%=2;
        os_task_delay(500);
    }
}
